<template>
  <div class="flight-query-page">
    <el-row class="page-header">
      <el-col :span="24">
        <!-- Logo and Navigation -->
      </el-col>
    </el-row>
    <el-row class="query-form-container">
      <el-col :span="24">
        <el-card class="query-form">
          <h3>航班查询</h3>
          <el-form @submit.native.prevent="submitQuery">
            <el-form-item label="航班号">
              <el-input v-model="queryData.flightNumber"></el-input>
            </el-form-item>
            <el-form-item label="出发日期">
              <el-date-picker
                  v-model="queryData.departureDate"
                  type="date"
                  placeholder="选择日期">
              </el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="submitQuery" class="primary">查询</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </el-col>
      </el-row>
    <el-row class="results-container">
      <el-col :span="24">
        <el-card class="results">
          <div v-if="flights.length === 0">没有找到航班信息。</div>
          <el-table :data="flights" style="width: 100%" v-else>
            <el-table-column prop="flightNumber" label="航班号"></el-table-column>
            <el-table-column prop="departure" label="出发地"></el-table-column>
            <el-table-column prop="destination" label="目的地"></el-table-column>
            <el-table-column prop="departureTime" label="出发时间"></el-table-column>
            <el-table-column prop="arrivalTime" label="到达时间"></el-table-column>
          </el-table>
          <el-pagination
              layout="prev, pager, next"
              :total="totalResults"
              @current-change="handlePageChange">
          </el-pagination>
        </el-card>
      </el-col>
    </el-row>
    <el-row class="page-footer">
      <el-col :span="24">
        <!-- Footer Content -->
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryData: {
        flightNumber: '',
        departureDate: ''
      },
      flights: [],
      totalResults: 0,
      currentPage: 1
    };
  },
  methods: {
    submitQuery() {
      // Submit query and fetch results
    },
    fetchFlights(page) {
      // Fetch flights from the server
    },
    handlePageChange(newPage) {
      // Handle page change in pagination
    }
  }
};
</script>

<style scoped>
/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 页面主体样式 */
.flight-query-page {
  font-family: 'Arial', sans-serif;

  color: #333; /* 文字颜色 */
  padding: 20px;
}

/* 页眉和页脚样式 */
.page-header, .page-footer {


  text-align: center;
  padding: 10px 0;
  margin: 0;
}

/* 查询表单样式 */
.query-form-container {
  background-color: white; /* 表单背景色 */
  padding: 20px;
  border-radius: 8px; /* 圆角边框 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 轻微的阴影 */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin-top: 60px;
}
.query-form {
  width: 100%;
  max-width: 400px; /* 限制表单的最大宽度 */
}
.query-form h3 {
  color: #3498db; /* 标题颜色 */
  text-align: center;
  margin-bottom: 20px;
}

.primary{
  margin: auto;
}

/* 结果展示区域样式 */
.results {
  margin-top: 20px;
}

.el-table th {
  background-color: #e6f7ff; /* 表头背景色 */
  color: #3498db; /* 表头文字颜色 */
}

.el-table td {
  border-bottom: 1px solid #dfe4ed; /* 单元格边框 */
}


.el-pager li {
  background-color: #3498db; /* 分页按钮颜色 */
  color: white;
  border-radius: 4px;
  margin: 0 5px;
}

.el-pager li.active {
  background-color: #2980b9; /* 当前页按钮颜色 */
}

/* 响应式设计 */
@media (max-width: 768px) {
  .el-row {
    flex-direction: column;
  }
}

</style>